export function dedent(strings: TemplateStringsArray, ...values: any[]): string {
    let fullString = strings.reduce((result, string, i) => result + values[i - 1] + string);
    // 去除开头的换行符
    if (fullString.startsWith('\n')) {
        fullString = fullString.slice(1);
    }

    // Match all lines and strip the same number of leading whitespaces from each line
    const match = fullString.match(/^[ \t]*(?=\S)/gm);
    if (!match) return fullString;

    const indent = Math.min(...match.map(el => el.length));
    const regex = new RegExp(`^[ \\t]{${indent}}`, 'gm');
    return indent > 0 ? fullString.replace(regex, '') : fullString;
}
